package com.yimi.yinhepda.views.sort_module;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.pda.ym.base.BaseActivity;
import com.yimi.yinhepda.R;
import com.yimi.yinhepda.utils.Common;
import com.yimi.yinhepda.views.unload_module.palletbind.ForkliftUnBindActivity;
import com.yimi.yinhepda.views.unload_module.palletbind.SingleUnBindActivity;

/**
 * 分拣管理选择界面
 * @author lj
 */
public class SortingSelectActivity extends BaseActivity {

    private Button btnSorting;
    private Button btnFolkLift;
    private Button btnSingleUnbind;
    private Button btnBack;
    /**
     * 部门类型
     */
    private int mDeptType;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sorting_select);

        btnFolkLift = findViewById(R.id.btn_forklift);
        btnSorting = findViewById(R.id.btn_sorting);
        btnSingleUnbind = findViewById(R.id.btn_single_unbind);
        btnBack = findViewById(R.id.btn_back);

        btnFolkLift.setOnClickListener(this);
        btnSingleUnbind.setOnClickListener(this);
        btnSorting.setOnClickListener(this);
        btnBack.setOnClickListener(this);

        mDeptType = sharedPreferUtil.getIntValue(Common.DEPT_TYPE);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_sorting:
                //分拣管理
                startActivity(new Intent(this, SortingActivity.class));
                break;
            case R.id.btn_forklift:
                mDeptType = sharedPreferUtil.getIntValue(Common.DEPT_TYPE);
                //叉车分货
                if (mDeptType == 5 || mDeptType == 6) {
                    startActivity(new Intent(this, ForkliftUnBindActivity.class));
                } else {
                    showToast("网点不可使用该功能");
                }
                break;
            case R.id.btn_single_unbind:
                //单独绑定
                if (mDeptType == 5 || mDeptType == 6) {
                    startActivity(new Intent(this, SingleUnBindActivity.class));
                } else {
                    showToast("网点不可使用该功能");
                }
                break;
            case R.id.btn_back:
                finish();
                break;
            default:
                break;
        }
    }
}
